package cn.life.business.factory.service.impl;

import cn.life.business.factory.dao.FactoryDao;
import cn.life.business.factory.entity.po.FactoryPo;
import cn.life.business.factory.service.FactoryService;
import cn.life.common.entity.model.CMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:    工厂Service层
 *
 * @Author 李佳明
 * @Date 2018/7/19 0019 下午 4:06
 */
@Service
public class FactoryServiceImpl implements FactoryService {

    @Autowired
    private FactoryDao factoryDao;

    @Override
    public CMessage addFactory(FactoryPo actoryPo) {
        return factoryDao.addFactory(actoryPo) == 1 ? CMessage.addSuccess() : CMessage.addFail();
    }

    @Override
    public CMessage updateFactory(FactoryPo actoryPo) {
        return factoryDao.updateFactory(actoryPo) == 1 ? CMessage.modifySuccess() : CMessage.modifyFail();
    }

    @Override
    public CMessage deleteFactory(FactoryPo actoryPo) {
        return factoryDao.deleteFactory(actoryPo) == 1 ? CMessage.removeSuccess() : CMessage.removeFail();
    }

    @Override
    public CMessage queryFactoryDetail(FactoryPo actoryPo) {
        return CMessage.success("查询成功",factoryDao.queryFactoryDetail(actoryPo));
    }
}
